<template>
	<view>
		<uni-table stripe emptyText="暂无更多数据">
			<uni-tr>
				<uni-th align="center">请假人姓名</uni-th>
				<uni-th align="center">请假人头像</uni-th>
				<uni-th align="center">请假起始时间</uni-th>
				<uni-th align="center">结束时间</uni-th>
				<uni-th align="center">请假状态</uni-th>
			</uni-tr>
			<uni-tr  @click.native="trclick(item.id)" v-for="(item,index) in pastlist" :key="index">
				<uni-td align="center">{{item.studentName}}</uni-td>
				<uni-td align="center">
					<image style="width: 100rpx;" :src="base+item.imgavater" mode="widthFix"></image>
				</uni-td>
				<uni-td align="center">{{item.leaveTimeStart}}</uni-td>
				<uni-td align="center">{{item.leaveTimeEnd}}</uni-td>
				<uni-td align="center">{{paststat[item.leaveType-1]}}</uni-td>
			</uni-tr>
		</uni-table>
		<button @click="log">请假登记</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				base:'',
				paststat:["事假","病假"],
				pastlist:[]
				
			}
		},
		onLoad() {
				this.base=this.$request.baseurl
				this.getpastlist()
			},
			methods: {
				log(){
					uni.navigateTo({
						url:"/pages/leave/leaveinfo/leaveinfo"
					})
					
				},
				trclick(id){
					uni.navigateTo({
						url:'/pages/pastinfo/pastinfo?id='+id+'&faly=true'
					})
				},
				async getpastlist(){
					const res=await this.$request.pastlist()
					console.log(res)
					this.pastlist=res.data.rows
				}
			}
		
	}
</script>

<style>

</style>
